//
//  AppTVVideoPlayController.m
//  classicFilms
//
//  Created by 刘继丹 on 17/4/20.
//  Copyright © 2017年 Stefan Arn. All rights reserved.
//

#import "AppTVVideoPlayController.h"
#import "PlayerView.h"
#import <AVFoundation/AVFoundation.h>

@interface AppTVVideoPlayController ()


@end

@implementation AppTVVideoPlayController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSURL *url = [NSURL URLWithString:_video_url];

//    self.player = [AVPlayer playerWithURL:url];
//    AVPlayerLayer *avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];
//    
//    avPlayerLayer.frame = CGRectMake(0, 0, view.frame.size.width, view.frame.size.height);
//    [view.layer addSublayer:avPlayerLayer];
//    
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(replayMovie:) name:AVPlayerItemDidPlayToEndTimeNotification object:nil];
//    
//    [self.player play];
    
//    AVPlayer *player = [[AVPlayer alloc] initWithURL: [NSURL URLWithString: wifiStreamAddress] ];
//    AVPlayerViewController *playerViewController = [[AVPlayerViewController alloc] init];
//    playerViewController.player = player;
//    
//    // Keep pointers to player and controller using retained properties:
//    self.player = player;
//    self.playerViewController = playerViewController;
//    
//    [player release];
//    [playerViewController release];
//    
//    [self presentViewController: playerViewController animated: true completion: ^{
//        [self.player play];
//    }];
    
    
//    AVPlayerViewController *viewController = [[AVPlayerViewController alloc] initWithNibName:nil bundle:nil];
//    viewController.player = player;
//    
//    [self addChildViewController:viewController];
//    [self.view addSubview:viewController.view];
//    [viewController didMoveToParentViewController:self];
//    
    // setup constraints, etc.
    
    // play the video
//    [player play];
    
    PlayerView *playView=[[PlayerView alloc] initWithFrame:self.view.bounds];
    [playView playWith:url];
    [self.view addSubview:playView];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}



@end
